package com.example.cloudpracticeplatform.mapper;

import com.example.cloudpracticeplatform.entity.ExperimentContainer;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface ExperimentContainersMapper {
    @Insert("INSERT INTO experiment_containers(enrollment_id, docker_container_id, address, username, password, start_time, end_time, status) VALUES(#{enrollmentId}, #{dockerContainerId}, #{address}, #{username}, #{password}, #{startTime}, #{endTime}, #{status})")
    int insert(ExperimentContainer experimentContainer);
    
    int update(ExperimentContainer experimentContainer);
    
    @Select("SELECT * FROM experiment_containers WHERE enrollment_id = #{enrollmentId}")
    ExperimentContainer findByEnrollmentId(Integer enrollmentId);
}
